package com.baturu.vin.dffx.dal.dao;

import com.baturu.vin.dffx.dto.DffxPartsMappingDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @Author: chenjiahao
 * @Time: 2018/9/27
 */
public interface DffxPartsMappingDAO {

    @Select({"<script>SELECT partsCode ,btrPartsName,Series ",
            "FROM dffx_parts_mapping ",
            "WHERE  btrPartsName in ",
            "<foreach item='item' index = 'index' collection='list' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"
    })
    List<DffxPartsMappingDTO> queryPartsMappingBySeriesAndBtrPartsName( @Param("list") Set<String> btrPartsName);

    @Select({"<script>SELECT partsCode,btrPartsName,Series",
            "FROM dffx_parts_mapping",
            "WHERE series = #{series}",
            "AND partsCode in ",
            "<foreach item='item' index = 'index' collection='partsCode' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<DffxPartsMappingDTO>queryByPartsCode(@Param("series")String series, @Param("partsCode") Set<String> partsCode);
}
